package com.corpgovernment.organization.entity.db;

import com.corpgovernment.common.annotation.OperateLogFieldDesc;
import com.corpgovernment.common.entity.db.BaseEntity;
import com.corpgovernment.common.enums.CommonEnum;
import com.corpgovernment.common.handler.Sm4TypeHandler;
import com.corpgovernment.organization.enumm.UserRoleEnum;
import com.corpgovernment.organization.enumm.ValidEnum;
import com.ctrip.corp.obt.shard.annotation.SecurityFuzzyQueryEntity;
import com.ctrip.corp.obt.shard.annotation.SecurityFuzzyQueryField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import tk.mybatis.mapper.annotation.ColumnType;

import javax.persistence.*;
import java.util.Date;


/**
 * 员工用户信息表
 *
 * @author wangyujue
 **/
@SuppressWarnings("serial")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "mb_org_employee_info")
@SecurityFuzzyQueryEntity
public class MbOrgEmployeeInfo extends BaseEntity {

    /**
     * 主键
     **/
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @OperateLogFieldDesc(value = "主键")
    private Long id;

    /**
     * 用户Id（_SLXXXXXX）
     **/
    @Column(name = "uid")
    @OperateLogFieldDesc(value = "用户Id")
    private String uid;

    /**
     * 用户名
     **/
    @Column(name = "name")
    @OperateLogFieldDesc(value = "用户名")
	@ColumnType(typeHandler = Sm4TypeHandler.class)
    @SecurityFuzzyQueryField(divideLength = 1)
    private String name;

    /**
     * 用户状态 T:使用中  F:已停用
     **/
    @Column(name = "valid")
    @OperateLogFieldDesc(value = "用户状态", type = ValidEnum.class)
    private String valid;

    /**
     * 用户手机
     **/
    @Column(name = "mobile_phone")
    @OperateLogFieldDesc(value = "用户手机")
	@ColumnType(typeHandler = Sm4TypeHandler.class)
    private String mobilePhone;

    /**
     * 手机码
     */
    @Column(name = "area_code")
    private String areaCode;

    /**
     * 邮箱
     **/
    @Column(name = "email")
    @OperateLogFieldDesc(value = "邮箱")
    private String email;

    /**
     * 用户性别 M:男  F:女
     **/
    @Column(name = "gender")
    @OperateLogFieldDesc(value = "用户性别")
    private String gender;

    /**
     * 生日
     **/
    @Column(name = "birthday")
    @OperateLogFieldDesc(value = "生日")
    private Date birthday;

    /**
     * 英文名前部
     **/
    @Column(name = "first_en_name")
    @OperateLogFieldDesc(value = "英文名前部")
	@ColumnType(typeHandler = Sm4TypeHandler.class)
    private String firstEnName;

    /**
     * 英文名中间
     **/
    @Column(name = "mid_en_name")
    @OperateLogFieldDesc(value = "英文名中间")
	@ColumnType(typeHandler = Sm4TypeHandler.class)
    private String midEnName;

    /**
     * 英文名最后
     **/
    @Column(name = "last_en_name")
    @OperateLogFieldDesc(value = "英文名最后")
	@ColumnType(typeHandler = Sm4TypeHandler.class)
    private String lastEnName;

    /**
     * 国籍二字码
     **/
    @Column(name = "nationality")
    @OperateLogFieldDesc(value = "国籍二字码")
    private String nationality;

    /**
     * 国籍代码
     **/
    @Column(name = "nation_code")
    @OperateLogFieldDesc(value = "国籍代码")
    private String nationCode;

    /**
     * 国籍名称
     **/
    @Column(name = "nation_name")
    @OperateLogFieldDesc(value = "国籍名称")
    private String nationName;

    /**
     * 是不是后台用户
     */
    @Column(name = "is_background")
    @OperateLogFieldDesc(value = "是不是后台用户", type = CommonEnum.class)
    private Boolean isBackground;
    /**
     * 用户角色 0员工 1领导 2秘书 3财务 4结算
     */
    @Column(name = "user_role")
    @OperateLogFieldDesc(value = "用户角色", type = UserRoleEnum.class)
    private String userRole;

    /**
     * 头像
	 */
	@Column(name = "portrait")
	@OperateLogFieldDesc(value = "头像")
	private String portrait;

	/**
	 * 删除时间，1970-01-01 08:00:00.000代表未删除
	 **/
	@Column(name = "delete_time")
	private java.util.Date deleteTime;

	/**
	 * 银行卡号
	 */
	@Column(name = "credit_card_numbers")
	@ColumnType(typeHandler = Sm4TypeHandler.class)
	private String creditCardNumbers;


    @Column(name = "reconciliation_email")
    @OperateLogFieldDesc(value = "是否接收对账邮件")
	private Boolean reconciliationEmail;

    @Column(name = "is_bind_ctrip_account")
    private Boolean isBindCtripAccount;

    /**
     * 员工类型 0：正式员工，1：非正式员工
     */
    @Column(name = "employee_type")
    private Integer employeeType;


	/**
	 * 0拒绝，1正常，2待审核，3离职
	 */
	@Transient
	private Integer status;

	/**
	 * 是否为负责人
	 */
    @Transient
    private Boolean isLeader;

    /**
     * 组织结构id
     */
    @Transient
    private String orgId;
    /**
     * 岗位id
     */
    @Transient
    private Long postId;
    /**
     * vip等级
     */
    @Transient
    private Integer vipLevel;
    /**
     * 密码
     */
    @Transient
    private String pwd;

    /**
     * 部门名称
     */
    @Transient
    private String orgName;
    /**
     * 公司名称
     */
    @Transient
    private String companyName;

    /**
     * 职级名称
     */
    @Transient
    @ColumnType(typeHandler = Sm4TypeHandler.class)
    private String postName;
    /**
     * 成本中心名称
     */
    @Transient
    private String costName;
    /**
     * 角色
     */
    @Transient
    private String roleName;
    /**
     * 上级员工编号
     */
    @Transient
    private String manageUid;

    /**
     *  法人公司
     */
    @Column(name = "corporate_entity")
    private String corporateEntity;

    /**
     * 姓名信息
     **/
    @Column(name = "name_info")
    @OperateLogFieldDesc(value = "姓名信息")
    @ColumnType(typeHandler = Sm4TypeHandler.class)
    private String nameInfo;

    @Column(name = "datachange_lasttime")
    private String dataChangeLastTime;
}
